<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


Route::post('test', "Api\Common\CommonController@ossUpload"); //通用上传文件

//通用路由设置
Route::group(['prefix' => 'common', 'middleware' => ['core'], 'namespace' => 'Api\Common'], function () {
    Route::get('mz/url', "CommonController@getMZUrl"); //第三方外链
    Route::post('antest/email', "CommonController@antestEmail"); //第三方
    Route::post('anbio/email', "CommonController@anbioEmail"); //第三方
    Route::post('jijin/email', "CommonController@jijinEmail"); //第三方
    Route::post('upload', "CommonController@ossUpload"); //通用上传文件
    Route::get('kuaidi', "CommonController@kuaidi"); //查询物流
    Route::get('district', "CommonController@district"); //查询物流
    Route::post('code', "CommonController@code"); //短信验证码
    Route::get('cards', "CommonController@idcard"); //身份证识别
    Route::get('test', "TestController@test"); //测试
    Route::post('test', "TestController@test"); //测试
    Route::get('city', "CommonController@cityImport"); //城市导入
    Route::get('weather', "CommonController@weather"); //天气
    Route::post('uuid', "CommonController@uuid"); //保存苹果uuid

});
Route::group(['prefix' => 'v1', 'middleware' => ['core'], 'namespace' => 'Api\Common'], function () {
    Route::get('oss/account', "CommonController@getAccess"); //获取oss拼争
});

////支付回调路由
//Route::group(['prefix' => '/v1/server/pay/callback', 'namespace' => 'Api\V1\Manager\Mall'], function () {
//    Route::post('batch/ali', "NewPayCallbackController@aliCallback"); //支付宝批量打款回调
//    Route::post('wx', "PayCallbackController@wxCallback"); //微信支付回调
//    Route::post('ali', "PayCallbackController@aliCallback"); //支付宝支付回调
//    Route::post('recharge', "PayCallbackController@callbackRecharge");  //充值回调
//    Route::post('ali/recharge', "PayCallbackController@aliRechargeCallback");  //充值回调
//    Route::post('verify/receipt', "PayCallbackController@verifyReceipt");  //充值回调
//});
//
//Route::group(['prefix' => 'v1/front', 'middleware' => ['core'], 'namespace' => 'Api\V1\Front\Mall'], function () {
//    Route::post('h5/order', "OrderController@h5Order"); //下单支付
//});
//
//Route::group(['prefix' => 'v1/mall', 'namespace' => 'Api\V1\Front\Mall'], function () {
//    Route::get('/order/wepay/web/{orderNo}', "OrderController@wxScanNativePay"); //微信电脑网站扫码支付
//    Route::get('/order/wepay/h5/{orderNo}', "OrderController@wxH5NativePay"); //微信手机网站支付
//    Route::get('/order/alipay/web/{orderNo}', "OrderController@aliWebPay"); //支付宝电脑网站支付
//    Route::get('/order/alipay/mobile/{orderNo}', "OrderController@aliMobilePay"); //支付宝手机网站支付
//});

//微信接口
Route::group(['prefix' => 'v1/front/wx', 'middleware' => ['core'],'namespace' => 'Api\V1\Front\Wx'], function () {
    Route::get('code', 'WxController@getUserInfoByCode'); //通过code获取用户详情
    Route::get('config', 'WxController@getWxConfig'); //微信JS权限配置
    Route::get('login', 'WxController@login');   //微信小程序登录
    Route::post('register', 'WxController@register');   //微信小程序注册
});

Route::group(['prefix' => 'v1/front/wx', 'middleware' => ['core'],'namespace' => 'Api\V1\Front\Wx'], function () {
    Route::post('phone', 'WxController@getPhone');   //获取微信手机号
});

//Route::group(['prefix' => 'v1/front', 'middleware' => ['core'], 'namespace' => 'Api\V1\Front\Wx'], function () {
//    Route::post('wxpay', "WxController@wxpay"); //微信支付
//});


//后台

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Index'], function () {
    Route::get('index/price', 'IndexController@indexPrice');   //首页-销售额曲线
    Route::resource('index', 'IndexController');   //首页
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Order'], function () {
    Route::get('after/order/negotiation/{orderReturnId}', 'AfterOrderController@negotiationHistory');   //售后协商记录详解
    Route::post('after/order/rechanging', 'AfterOrderController@rechanging');   //同意退货
    Route::post('after/order/agressd', 'AfterOrderController@agressdNew');   //同意退款
    Route::post('after/order/refund', 'AfterOrderController@refundNew');   //拒绝售后
    Route::get('order/wuliu', 'OrderController@getWuliu');   //获取物流信息
    Route::post('order/break', 'OrderController@setBreak');   //填写备注
    Route::post('order/break/delete', 'OrderController@deleteBreak');   //取消备注
    Route::post('order/send', 'OrderController@sendOrder');   //发货
    Route::post('after/order/upBreak', 'AfterOrderController@upBreak');   //售后订单修改备注
    Route::resource('integral/order', 'IntegralOrderController');   //积分订单管理
    Route::resource('after/order', 'AfterOrderController');   //售后订单管理
    Route::resource('order', 'OrderController');   //订单管理
});
//问卷调查
Route::group(['prefix' => 'v1/front', 'middleware' => [],'namespace' => 'Api\V1\Front\User'], function () {
    Route::post('questionnaire', 'QuestionnaireController@postQuestionnaire');   //提交问卷
    Route::get('questionnaire', 'QuestionnaireController@getQuestionnaire');   //查询问卷
});

Route::group(['prefix' => 'v1/manager', 'middleware' => [],'namespace' => 'Api\V1\Manager\System'], function () {
    Route::get('kuaidi', 'SystemController@kuaidilist');   //快递公司列表
});

Route::group(['prefix' => 'v1/manager', 'middleware' => [],'namespace' => 'Api\V1\Manager\User'], function () {
    Route::post('login/ups', 'LoginController@updatePassWord');   //修改密码
    Route::post('login', 'LoginController@login');   //管理员登录
});
Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\User'], function () {
    Route::post('loginout', 'LoginController@loginout');   //管理员退出登录
    Route::get('login/info', 'LoginController@info');   //重新获取个人信息
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\User'], function () {
    Route::get('user/statistics/month', 'UserController@statisticsMonth');   //用户统计曲线图
    Route::get('user/statistics/index', 'UserController@statisticsIndex');   //用户会员充值
    Route::get('user/vip', 'UserController@vipUserList');   //用户会员充值
    Route::get('user/invite', 'UserController@inviteUserList');   //用户邀请列表
    Route::resource('user', 'UserController');   //用户管理
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Activity'], function () {
    Route::put('kill/detail/{id}', 'KillController@killIndex');   //秒杀置顶
    Route::post('kill/detail', 'KillController@killDetail');   //秒杀新增修改
    Route::put('bomb/detail/{id}', 'BombController@bombIndex');   //炸弹炸弹置顶
    Route::post('bomb/detail', 'BombController@bombDetail');   //炸弹新增修改
    Route::get('luck/detail', 'LuckController@luckDetailList');   //大转盘中奖记录
    Route::post('luck/detail', 'LuckController@luckDetail');   //大转盘奖励编辑
    Route::get('red/log', 'RedController@redLog');   //红包兑换记录
    Route::post('red/detail', 'RedController@redDetail');   //红包编辑
    Route::resource('kill', 'KillController');   //秒杀管理
    Route::resource('luck', 'LuckController');   //大转盘管理
    Route::resource('red', 'RedController');   //红包管理
    Route::resource('bomb', 'BombController');   //炸弹管理
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Good'], function () {
    Route::post('integral/good/delete/more', 'GoodController@deleteMore');   //积分商品批量删除
    Route::put('integral/good/update/more', 'GoodController@updateMore');   //积分商品批量下架
    Route::post('good/delete/more', 'GoodController@deleteMore');   //商品批量删除
    Route::put('good/update/more', 'GoodController@updateMore');   //商品批量下架
    Route::post('good/stock', 'GoodController@stockStore');   //商品规格详情修改
    Route::post('integral/good/stock', 'IntegralGoodController@stockStore');   //商品规格详情修改
    Route::get('good/stock', 'GoodController@stock');   //商品规格详情列表
    Route::get('integral/good/stock', 'IntegralGoodController@stock');   //商品规格详情列表
    Route::post('good/transfer', 'GoodController@transfer');   //商品分类转移
    Route::post('integral/good/transfer', 'IntegralGoodController@transfer');   //积分商品分类转移
    Route::resource('welfare/good', 'GoodWelfareController');   //福利商品
    Route::resource('goods/type/two', 'GoodTwoTypeController');   //商品二级分类
    Route::resource('goods/type/one', 'GoodOneTypeController');   //商品一级分类
    Route::resource('good', 'GoodController');   //商品列表
    Route::resource('integral/good', 'IntegralGoodController');   //积分商品列表
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Supplier'], function () {
    Route::delete('supplier/freight/rule', 'SupplierFreightController@delRule');   //删除运费规则
    Route::get('supplier/freight/rule', 'SupplierFreightController@getRule');   //获取运费规则
    Route::post('supplier/freight/rule', 'SupplierFreightController@setRule');   //设置运费规则
    Route::get('supplier/freight/area', 'SupplierFreightController@getArea');   //供应商运费模板地区列表
    Route::post('supplier/freight/area/no', 'SupplierFreightController@setAreaNo');   //设置非免邮地区
    Route::post('supplier/freight/area/yes', 'SupplierFreightController@setAreaYes');   //设置免邮地区
    Route::delete('supplier/end/{id}', 'SupplierController@supplierEnd');   //供应商终止合作
    Route::resource('brand', 'BrandController');   //品牌列表
    Route::resource('supplier/freight', 'SupplierFreightController');   //供应商模板列表
    Route::resource('supplier', 'SupplierController');   //供应商列表
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\System'], function () {
    Route::resource('search', 'SearchController');   //搜索列表
    Route::resource('mgc', 'MgcController');   //敏感词管理
    Route::resource('yinsi', 'YinsiController');   //隐私协议
    Route::resource('help', 'HelpController');   //帮助管理
    Route::resource('about', 'AboutController');   //关于我们
    Route::resource('message', 'MessageController');   //消息管理
    Route::resource('relation', 'RelationController');   //联系我们
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Admin'], function () {
    Route::get('admin/log', 'AdminController@log');   //管理员日志
    Route::resource('admin', 'AdminController');   //管理员管理
});

Route::group(['prefix' => 'v1/manager', 'middleware' => ['AdminLogin'],'namespace' => 'Api\V1\Manager\Marketing'], function () {
    Route::get('jin/good/list', 'JinController@goodList');   //金刚区商品列表
    Route::get('banner/good', 'BannerController@goodList');   //轮播图商品列表
    Route::get('banner/jin', 'BannerController@jinList');   //轮播图金刚区列表
    Route::resource('jin/good', 'JinGoodController');   //金刚区商品管理
    Route::resource('jin', 'JinController');   //金刚区管理
    Route::resource('banner', 'BannerController');   //广告管理
});